package com.ruoyi.web.controller.qqLoginAndPayByHTQ;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;

public class getIP {
	public static String getIpconfig(){
		StringBuilder IFCONFIG=new StringBuilder();  
		   try {  
		       for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {  
		           NetworkInterface intf = en.nextElement();  
		           for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {  
		               InetAddress inetAddress = enumIpAddr.nextElement();  
		               if (!inetAddress.isLoopbackAddress() && !inetAddress.isLinkLocalAddress() && inetAddress.isSiteLocalAddress()) {  
		               IFCONFIG.append(inetAddress.getHostAddress().toString()+"\n");  
		               }  
		  
		           }  
		       }  
		   } catch (SocketException ex) {  
		   }  
		   return IFCONFIG.toString();
	}

}
